import React, { Component, createRef } from 'react'
/* 子类 */
function List(props) {
    const { ll } = props
    return (
        <ul>{ll.map((item, i) => { return <li key={i}>{item}</li> })}</ul>
    )
}
export default class test00 extends Component {
    state = {list:[111, 22, 333]}
    muyin = createRef();
    add = () => {
        const val = this.muyin.current.value;
        const {list} = this.state
        list.push(val);
        /*  新对象 list 是不同的对象state  基本数据类型,值不同,就是不同东西 */
        this.setState({list})
    }
    render() {
        const { list } = this.state
        return (
            <div>
                <input type="text" ref={this.muyin} /> <br />
                <button onClick={this.add}>请点击</button>
                <List ll={list}></List>
            </div>
        )
    }
}

